/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package jollylengkono.skripsi.CollaborativeWorks.action;

import java.util.ArrayList;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import jollylengkono.skripsi.dao.CollaborativeWorksDao;
import jollylengkono.skripsi.model.CollaborativeWorks;
import jollylengkono.skripsi.model.Members;
import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;

/**
 *
 * @author hp02
 */
public class CollaborativeWorksGetListByMember extends Action {

    public CollaborativeWorksGetListByMember() {
    }

    @Override
    public ActionForward execute(ActionMapping mapping, ActionForm form, 
            HttpServletRequest request, HttpServletResponse response) {
        HttpSession sess = request.getSession(true);
        Members member = (Members) sess.getAttribute("memberSessObject");
        long id = member.getId();
        List<CollaborativeWorks> collaborativeWorks = new ArrayList<CollaborativeWorks>();
        collaborativeWorks = new CollaborativeWorksDao().getListByMember(id);
        request.setAttribute("collaborativeWorks", collaborativeWorks);
        return mapping.findForward("success");
    }

}
